/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
/*   如果该节点的左节点不为空，该节点的左节点的左节点和右节点都为空，则是左叶子    */
    int sumOfLeftLeaves(TreeNode* root) {
        if(root == NULL) return 0;
        int left_cnt = 0;
        if(root->left != NULL && root->left->left == NULL \
           && root->left->right == NULL ){
               left_cnt = root->left->val;
           }

        return left_cnt+sumOfLeftLeaves(root->left)+sumOfLeftLeaves(root->right);
    }
};